package org.starapp.generator;

import java.util.List;

import org.starapp.utils.ListUtils;
import org.starapp.utils.StringUtils;

public class Table {
	// tableDescription
	private String tableDescription;
	// tablename
	private String tableName;
	// className
	private String className;
	//
	private String classAttrName;

	// Self Reference Column Name
	private String selfReferenceColumnName;

	private String tableCat;

	private String tableSchem;

	private String tableType;// TABLE,VIEW,SYSTEM TABLE,GLOBAL TEMPORARY,LOCAL
	// TEMPORARY,ALIAS,SYNONYM
	private String remarks;

	private String typeCat;

	private String typeSchem;

	private String typeName;

	private String refGeneration;// SYSTEM,USER,DERIVED

	private String firstPrimaryKey;


	// 关系表不显示
	private boolean hidden;

	// fields
	private List<TableField> fields;
	// primaryKey
	private List<PrimaryKey> primaryKeys;
	// foreignKey
	private List<ForeignKey> foreignKeys;

	public String getSelfReferenceColumnName() {
		return selfReferenceColumnName;
	}

	public void setSelfReferenceColumnName(String selfReferenceColumnName) {
		this.selfReferenceColumnName = selfReferenceColumnName;
	}

	public String getTableDescription() {
		return tableDescription;
	}

	public void setTableDescription(String tableDescription) {
		this.tableDescription = tableDescription;
	}

	public boolean isHidden() {
		return hidden;
	}

	public void setHidden(boolean hidden) {
		this.hidden = hidden;
	}

	// Ref
	public List<RefField> refs;

	public List<RefField> getRefs() {
		return refs;
	}

	public void setRefs(List<RefField> refs) {
		this.refs = refs;
	}

	public String getClassName() {
		return className;
	}

	public void setClassName(String className) {
		this.className = className;
	}

	public String getClassAttrName() {
		return classAttrName;
	}

	public void setClassAttrName(String classAttrName) {
		this.classAttrName = classAttrName;
	}

	public String getTableName() {
		return tableName;
	}

	public void setTableName(String tableName) {
		this.tableName = tableName;
	}

	public List<TableField> getFields() {
		return fields;
	}

	public void setFields(List<TableField> fields) {
		this.fields = fields;
	}

	public List<PrimaryKey> getPrimaryKeys() {
		return primaryKeys;
	}

	public void setPrimaryKeys(List<PrimaryKey> primaryKeys) {
		this.primaryKeys = primaryKeys;
	}

	public List<ForeignKey> getForeignKeys() {
		return foreignKeys;
	}

	public void setForeignKeys(List<ForeignKey> foreignKeys) {
		this.foreignKeys = foreignKeys;
	}

	public String getTableCat() {
		return tableCat;
	}

	public void setTableCat(String tableCat) {
		this.tableCat = tableCat;
	}

	public String getTableSchem() {
		return tableSchem;
	}

	public void setTableSchem(String tableSchem) {
		this.tableSchem = tableSchem;
	}

	public String getTableType() {
		return tableType;
	}

	public void setTableType(String tableType) {
		this.tableType = tableType;
	}

	public String getRemarks() {
		return remarks;
	}

	public void setRemarks(String remarks) {
		this.remarks = remarks;
	}

	public String getTypeCat() {
		return typeCat;
	}

	public void setTypeCat(String typeCat) {
		this.typeCat = typeCat;
	}

	public String getTypeSchem() {
		return typeSchem;
	}

	public void setTypeSchem(String typeSchem) {
		this.typeSchem = typeSchem;
	}

	public String getTypeName() {
		return typeName;
	}

	public void setTypeName(String typeName) {
		this.typeName = typeName;
	}

	public String getRefGeneration() {
		return refGeneration;
	}

	public void setRefGeneration(String refGeneration) {
		this.refGeneration = refGeneration;
	}

	public String getFirstPrimaryKey() {
		if (StringUtils.isEmpty(firstPrimaryKey)
				&& !ListUtils.isEmpty(primaryKeys)) {
			firstPrimaryKey = primaryKeys.get(0).getJavaColumnAttrName();
		}
		return firstPrimaryKey;
	}

	public void setFirstPrimaryKey(String firstPrimaryKey) {
		this.firstPrimaryKey = firstPrimaryKey;
	}

}
